package com.zhangwei.zk1018.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zhangwei.zk1018.entity.Goods;
import com.zhangwei.zk1018.dao.GoodsMapper;
import com.zhangwei.zk1018.entity.GoodsVo;
import com.zhangwei.zk1018.entity.Gtypes;
import com.zhangwei.zk1018.service.IGoodsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author admin
 * @since 2021-10-18
 */
@Service
public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements IGoodsService {


    @Autowired
     private   RedisTemplate redisTemplate;

    @Autowired
    private GoodsMapper goodsMapper;
    @Override
    public PageInfo getList(GoodsVo vo, Integer pageNum, Integer pageSize) {

        PageHelper.startPage(pageNum,pageSize);
        List<Goods> list = goodsMapper.getList(vo);
        PageInfo<Goods> info = new PageInfo<>(list);
        return info;
    }

    @Override
    public List<Gtypes> getGtype() {





        return null;
    }

    @Override
    public Goods getGoodsById(Integer id) {
        System.err.println("goodsMapper===="+id);

        return goodsMapper.getGoodsById(id);
    }

    @Override
    public Integer delAll(String gids) {
        return goodsMapper.delAll(gids);
    }
}
